{% load i18n admin_static suit_list admin_list suit_tags %}
{% if cl.search_fields or cl.has_filters %}
  {% suit_bc_value 1.5 'pop' 1.6 '_popup' as POPUP_VAR %}
  <div id="toolbar" class="clearfix">
    <form id="changelist-search" action="" method="get" class="form-inline">
      <div class="search-container">
        {% if cl.search_fields %}
          <input type="text" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar" placeholder="{% block search_placeholder %}{% trans 'keyword'|capfirst %}{% endblock %}"{{ cl.query|yesno:' class=active,' }}>&nbsp;
          <script type="text/javascript">document.getElementById("searchbar").focus();</script>
        {% endif %}
        {% spaceless %}
          {% if cl.has_filters %}
            {% block filters %}
              {% if cl.has_filters %}
                <span class="search-filters">
                {% for spec in cl.filter_specs %}
                  {% suit_list_filter_select cl spec %}
                  &nbsp;
                {% endfor %}
                </span>
              {% endif %}
            {% endblock %}
          {% endif %}
        {% endspaceless %}

        <input type="submit" value="{% trans 'Search' %}" class="btn btn-info"/>
        &nbsp;
        {% if show_result_count %}
          <span class="small quiet result-count">{% blocktrans count counter=cl.result_count %}{{ counter }} result{% plural %}{{ counter }} results{% endblocktrans %}
          {% if cl.show_full_result_count %}
            &nbsp; <a href="?{% if cl.is_popup %}{{ POPUP_VAR }}=1{% endif %}">
              {% blocktrans with full_result_count=cl.full_result_count %}{{ full_result_count }} total{% endblocktrans %}</a>
          {% endif %}
          </span>
        {% endif %}
      </div>

      {% if cl.is_popup %}
        <input type="hidden" name="{{ POPUP_VAR }}" value="1">
      {% endif %}

      {% admin_extra_filters cl as extra_filters %}
      {% for pair in extra_filters.items %}
            {% if pair.0 != search_var %}<input type="hidden" name="{{ pair.0 }}" value="{{ pair.1 }}"/>{% endif %}
      {% endfor %}

    </form>
  </div>
{% endif %}
